<template>
	<view class="content">
		<u-navbar :autoBack="true"  :placeholder="true" safeAreaInsetTop  title="设置">
		</u-navbar>
		<view class="options">
		<u-cell-group :border='false'>
			<u-cell :border='false' v-for="(item,index) in optionsList" :key="index" :title="item.title" :isLink="true" :url="item.src"></u-cell>
		</u-cell-group>
		</view>
		<view class="version">
			<text>版本号</text>
			<text style="color: #999;">BM1.0.1</text>
		</view>
		<view class="exitbtn">
			<u-button type="primary" @click="show = true" :hairline="true" text="退出登录"></u-button>
		</view>
		<u-modal :show="show" :showCancelButton="true" 
		content='你确定要退出登录?' @confirm='rgokbtn' @cancel="show = false"></u-modal>
	</view>
</template>

<script>
	import {mapMutations,mapState} from 'vuex'
	export default{
		data(){
			return{
				optionsList:[
					{title:'用户协议',src:'/page_my/privacypact?type=4'},
					{title:'隐私政策',src:'/page_my/privacypact?type=3'},
					{title:'充值协议'}
				],
				show:false
			}
		},
		computed:{
			...mapState(['token'])
		},
		methods:{
			...mapMutations(['deletetoken','delusinfo','delopenid']),
		rgokbtn(){
			if(this.token){
				this.deletetoken()
				this.delusinfo()
				this.delopenid()
				uni.redirectTo({
					url:'/page_login/index'
				})
			}
		}
		}
	}
</script>

<style>
	page{
		background-color: #fafafa;
	}
	.content{
		padding: 0 40rpx;
	}
	.options{
		margin-top: 20rpx;
		background-color: #fff;
		padding: 20rpx 0;
		border-radius: 20rpx;
	}
	.data-v-913eaa32{
		margin: 4rpx 0;
	}
	.version{
		background-color: #fff;
		padding: 30rpx 20rpx;
		margin-top: 20rpx;
		border-radius: 10rpx;
		font-size: 28rpx;
		display: flex;
		justify-content: space-between;
	}
	.exitbtn{
		margin-top: 400rpx;
	}
</style>